import { http } from "@/utils/http";
import { baseUrlApi } from "@/api/utils";
import { Result, ResultTable } from "@/api/types";


/** 获取系统管理-用户管理列表 */
export const getUserList = (data?: object) => {
  return http.request<ResultTable>("post", baseUrlApi("user"), { data });
};
/** 系统管理保存-新增用户 */
export const saveUser = (data?: object) => {
 
  return http.request<ResultTable>("post", baseUrlApi("userSave"), { data });
};
/**删除系统管理-指定用户 */
export const deleteUser = (data?: object) => {
 
  return http.request<ResultTable>("delete", baseUrlApi("user"), { data });
};
/**更新系统管理-指定用户 */
export const updateUser = (data?: object) => {

  return http.request<ResultTable>("put", baseUrlApi("user"), { data });1
};
/**更新系统管理-指定用户 */
export const updateStatus = (data?: object) => {
  
  return http.request<ResultTable>("post", baseUrlApi("updateStatus"), { data });
};

/** 系统管理-用户管理-获取所有角色列表 */
export const getAllRoleList = () => {
  return http.request<Result>("get", baseUrlApi("listAllRole"));
};
/** 系统管理-用户管理-保存用户的角色 */
export const saveUserRole = (data?: object) => {
  return http.request<Result>("post", baseUrlApi("saveUserRole"), { data });
};

/** 系统管理-用户管理-重置密码 */
export const resetPassword = (data?: object) => {
  return http.request<Result>("post", baseUrlApi("resetPassword"), { data });
};

/** 系统管理-用户管理-根据userId，获取对应角色id列表（userId：用户id） */
export const getRoleIds = (data?: object) => {
  return http.request<Result>("post", baseUrlApi("listRoleIds"), { data });
};
